CC = gcc
DIR_OBJ = ./obj

DIR_INC = -I ./fun
DIR_INC += -I ./ech

DIR_SRC = $(wildcard ./*.c) 
DIR_SRC += $(wildcard ./fun/*.c) 
DIR_SRC += $(wildcard ./ech/*.c) 
OBJS = $(patsubst %.c,%.o, $(DIR_SRC))

all: $(OBJS)
	$(CC) -o $(DIR_OBJ)/all $(wildcard ./obj/*.o) 

$(OBJS):%.o: %.c
	$(CC) -c $< -o $(DIR_OBJ)/$(notdir $@) $(DIR_INC)

.PHONY:clean
clean:
	rm ./obj/*.o ./obj/all
	
	
dirs := fun ech obj
src := $(shell ls *.c)

test:
	$(src)